<?php
/**
 * 账号充值
 * User: tengyu
 * Date: 2017/9/1
 * Time: 14:52
 */?>
@extends('common.common')
@section('title','账户充值-个人充值')
@section('css')<link rel="stylesheet" href="{{asset('/css/personal_recharge.css')}}">@endsection
@section('js')
<script >
    function choosePay() {
        $("#choosePay li").click(function () {
            $(this).addClass('active').siblings('.active').removeClass('active');
            var pay_type = $(this).val();
            $("input[name='paytype']").val(pay_type);
        })
    }
    choosePay();
    $('#but').click(function(){
        var pay_type = $("input[name='paytype']").val();
        var money = $("input[name='recharge']").val();
        var reg = /^[0-9]+.?[0-9]*$/;
        if (money ==''){
            alert('请输入要充值的金额');
            return false;
        }else if(money < 0 ){
            alert('请输入正确的金额数值');
            return false;
        } else if(!reg.test(money)){
            alert('金额只能为数字');
            return false;
        }else if(money <1){
            alert('最少充值1元！');
            return false;
        }
        switch (pay_type){
            case '':
                alert('请选择支付方式');
                return false;
            case '3':
                alert('研发中。。。');
                return false;
        }
    })
</script>
@endsection
@section('content')
    <div id="content">
        <!--nav start-->
        @include('common.centernav')
        <!--nav end-->
        <h3>个人中心</h3>
        <div class="container">
            <div class="row">
                <!--sidebar start-->
                @include('usercenter.usersidebar')
                <!--sidebar end-->
                <!--2、右侧主体-->
                <div class="col-xs-9">
                    <!--右侧面版-->
                    <div class="panel panel-default rightPanel">
                        <div class="panel-heading">
                            <h4>账户信息</h4>
                        </div>
                        <div class="panel-body bodyone">
                            <form class="form-inline" id="/rechargee"  method="post">
                                {{csrf_field()}}
                                <div class="form-group">
                                    <label>充值金额：</label>
                                    <input type="text" class="form-control" name="recharge">
                                    <input  class="payType" type="hidden" name="paytype" >
                                </div>&nbsp;&nbsp;
                                <button id="but" class="btn btn-warning">立即充值</button>
                            </form>
                        </div>
                        <div class="panel-heading">
                            <h4>消费记录</h4>
                        </div>
                        <div class="panel-body bodytwo">
                            <ul id="choosePay">
                                <li value="1">
                                    <img class="active" src="{{asset('/img/wx.png')}}">
                                    <b class="active"></b>
                                </li>
                                <li value="2">
                                    <img src="{{asset('/img/zfb.png')}}">
                                    <b></b>
                                </li>
                                <li value="3">
                                    <img src="{{asset('/img/yl.png')}}">
                                    <b></b>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--隔断底部-->
    <div id="partition"></div>
@endsection
